﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>权限管理 - 帐号管理</title>
    <#include "/pages/include/head.ftl" />
	<#import "/pages/import/images.ftl" as img />
    <#assign contextPath = request.contextPath/>
    <style type="text/css">
      .tree-left-height{height:510px;}
   </style>
</head>
<body>
<@s.url var="editurl" action="input" namespace="/account" />
<@rw.gridToolbar grid="accountGrid"/>
<#assign model="account"/>
	<#assign gridId="${model + 'Grid'}">
	<@rw.gridToolbar grid="systemGrid"/>
		
<div class="page-top-bar">
<ul class="path">权限管理<span>&gt;</span>帐号管理</ul>
</div>
<div class="function-bar">
<ul class="form-function">
    
    <li id="menu1"><a href="javascript:void(0)" onclick="page('add.action')" onfocus="this.blur()"><img src="${contextPath}/images/ico16/ico-add.gif" alt="新建" border="0" title="新建" /></a></li>
    <li><a id="btn-modify"><img src="${contextPath}/images/ico16/ico-edit.gif" alt="修改" title="修改" /></a></li>
    <li><a id="accountGrid-delete"><img src="${contextPath}/images/ico16/ico-cancel.gif" alt="删除" title="删除" /></a></li>
    <li><a id="btn-lock"><img src="${contextPath}/images/ico16/group_key.gif" alt="锁定" title="锁定" /><span>锁定</span></a></li>
    <li><a id="btn-unlock"><img src="${contextPath}/images/ico16/group_key.gif" alt="解锁" title="解锁" /><span>解锁</span></a></li>
    <li><a id="btm-password-reset"><img src="${contextPath}/images/ico16/lock_edit.gif" alt="重置密码" title="重置密码" /><span>重置密码</span></a></li>
  </ul>
</div>
<div class="list-container">
<div class="list-search">
<@rw.gridForm id="searchform" grid="accountGrid">
	<div class="list-search">
	<ul>
		<li><label for="">帐户名称：</label><input name="criteria.username" type="text" class="input-common input-word-10" /></li>
	    <li><label for="">真实姓名：</label><input name="criteria.realName" type="text" class="input-common input-word-10" /></li>
		<li><label for="">锁定状态：</label>
			<select id="" name="criteria.locked" class="select-word-10">
	            <option value="">全部</option>
		    	<option value="ENABLED">已锁定</option>
	            <option value="DISABLED">非锁定</option>
			</select>
		</li>
		<li class="search-btn-area">
	      <div class="btn-order">
	        <ul>
	          <li class="left-normal"></li>
	          <li class="middle-normal" id="submit"><img src="${contextPath}/images/ico16/ico-search.gif" alt="查询" />查 询</li>
	          <li class="right-normal"></li>
	       </ul>
	      </div>
		</li>
	</ul>
	</div>
	</@rw.gridForm>
	</div>

<div id="grid" class="border">
<@rw.grid 
    	id="${gridId}" 
    	caption="帐户" 
    	dataType="json" 
    	pager="true" 
    	multiselect="true"
        width="1000"
    	gridModel="gridModel"
    	rowList="10,15,20"
    	rowNum="10"
    	rownumbers="true"
    	onGridCompleteTopics="grid-complete">
    	<@sj.gridColumn name="id" 			index="id"  hidden="true"  title="ID" 	sortable="false"/>
    	<@sj.gridColumn name="username" 		index="username"		title="帐户名称" 	formatter="showlink" formatoptions="{baseLinkUrl:'%{showurl}'}" />
        <@sj.gridColumn name="realName" 			index="realName"			title="用户真实姓名" 	sortable="false"/>
        <@sj.gridColumn name="email" 			index="email"			title="E-Mail" 	sortable="false"/>   
        <@sj.gridColumn name="registryDate" 			index="registryDate"			title="注册日期" 	sortable="false"/>  
        <@sj.gridColumn name="locked" 			index="locked"			title="锁定状态" 	sortable="false"/>  
</@rw.grid>
    <!-- grid body end -->
</div>
</div>
</body>
<script>

function page(url){
	window.open(url,"main","");
}
	$(function(){
		$("#${gridId}").enhanceGrid();
		$("#btn-modify").click(function(){
           var selectedIds = $("#${gridId}").jqGrid('getGridParam','selarrrow');
           if(selectedIds.length>1){
             alert("只能选择一个进行修改");
             return;
           }
           if(selectedIds.length==0){
             alert("请选中你所需要修改的记录");
             return;
           }
		   page('account-modify.action?id='+selectedIds);
		});
		

		$("#btn-unlock").click(function(){
		     var selectedIds = $("#${gridId}").jqGrid('getGridParam','selarrrow');
		      if(selectedIds==""){alert("未选中帐号");return;}
		     var yes = confirm("确定解锁所有选中的帐号?");
		     if(yes){
		           $.ajax({                                                
                     type: "POST",                                     
                     url: "paramAccount-unlockAccount.action",                                   
                     data: "selectedIds="+selectedIds,
                     success: function(msg){
                      alert("解锁成功");
                       $("#${gridId}").trigger("reloadGrid");
                      }
        }); 
		     } 
		});
		
		$("#btn-lock").click(function(){
		     var selectedIds = $("#${gridId}").jqGrid('getGridParam','selarrrow');
		      if(selectedIds==""){alert("未选中帐号");return;}
		     var yes = confirm("确定锁定所有选中的帐号?");
		     if(yes){
		           $.ajax({                                                
                     type: "POST",                                     
                     url: "paramAccount-lockAccount.action",                                   
                     data: "selectedIds="+selectedIds,
                     success: function(msg){
                      alert("锁定成功");
                       $("#${gridId}").trigger("reloadGrid");
                      }
        }); 
		     } 
		});
		
		$('#btm-password-reset').click(function(){
		   var selectedIds = $("#${gridId}").jqGrid('getGridParam','selarrrow');
           if(selectedIds.length>1){
             alert("只能选择一个进行密码重置");
             return;
           }
           if(selectedIds.length==0){
             alert("请选择需要重置的帐号");
             return;
           }
           
       top.windowOpen('account/paramAccount-getPasswordReset.action?id='+selectedIds, 'pop01', '统一授权平台管理系统 V1.0', 200,510);
		});
	});
	
	function page(p){
		window.open(p,"main","");
   }
	</script>
</html>